package com.example.score.entity;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * @author fsyj
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
@ToString
@Entity(name = "sportsman")
public class Sportsman implements Serializable {
    private static final long serialVersionUID = -3695846154892806704L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long uuid;

    private String event;
    private Double goal;
    private Double goal1;
    private Double goal2;
    private Double goal3;
    private Double goal4;
    private Double goal5;
    private Double goal6;
    private Double goal7;
    private Double goal8;
    private Double goal9;
    private Double goal10;
    private Double levelScore;
    private Double groupAAvg;
    private Double groupBAvg;
    private Long groupIndex;
    private String groupName;
    @Column(name = "sport_index")
    private Long index;
    @JsonProperty("name")
    private String sportName;
    @JsonProperty("time")
    private String sportTime;
    private String unit;
    private String area;
    private String reason;
    private String sportData;



    private String refereeId;

    /**
     * 未开始
     * 待开始
     * 进行中
     * 已结束
     * 已确认
     */
    private String status = "未开始";

    /**
     * 裁判长扣分
     */
    private String refereeDeduce;

    /**
     * 总裁判长扣分
     */
    private String finalDeduce;

    private String remark;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Sportsman sportsman = (Sportsman) o;
        return Objects.equals(groupIndex, sportsman.groupIndex) && Objects.equals(groupName, sportsman.groupName) && Objects.equals(sportName, sportsman.sportName) && Objects.equals(unit, sportsman.unit);
    }

    @Override
    public int hashCode() {
        return Objects.hash(groupIndex, groupName, sportName, unit);
    }
}
